package com.multidisplay.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.multidisplay.bo.ResultBo;
import com.multidisplay.mapper.AdminMapper;
import com.multidisplay.po.Admin;
import com.multidisplay.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    private AdminMapper adminMapper;

    @Override
    public ResultBo<Admin> findAll(int page, int limit){
        IPage iPage = new Page(page,limit);
        IPage<Admin> adminIPage = adminMapper.selectPage(iPage,null);
        ResultBo<Admin> resultBo = new ResultBo<>();
        resultBo.setCode(0);
        resultBo.setMsg("");
        resultBo.setCount(adminIPage.getTotal());
        resultBo.setData(adminIPage.getRecords());
        return resultBo;
    }
}
